#ifndef CHEETAH_GRAPHICS_SHADEROBJECT_H
#define CHEETAH_GRAPHICS_SHADEROBJECT_H

#include "cheetah/core/settings.h"
#include <GL/glew.h>

namespace cheetah {
namespace graphics {
enum { kFileSource, kByteSource };
class ShaderObject {
 public:
  static int ReadSahderFile(const char *file, char **code);
  /*
   * if source is shader code string, the caller should release it
   */
  ShaderObject(int shader_type, const char *source, 
               int source_type = kFileSource);
  ~ShaderObject();
  GLuint shader_id() const { return shader_id_; }
  bool is_valid() const { return is_compiled_; }

 private:
  void CheckCompileLog();
  void PrintCompileLog();

 private:
  GLuint shader_id_;
  bool is_compiled_;
};
} // graphics
} // cheetah

#endif // CHEETAH_GRAPHICS_SHADEROBJECT_H
